/**
 * 
 */
package pl.lodz.p.browarex.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;


@Entity(name = "INGREDIENT_ORDER_INFO")
public class IngredientOrderInfo {

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;
	
	@Column(name = "INGREDIENT_ID", nullable = false)
	private String ingredientId;
	
	
	@ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name="INGREDIENTID", nullable = false, updatable = false)
	private Ingredient ingredient;
	
	@Column(name = "AMOUNT", nullable = false)
	private int amount;

	@ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name="INGREDIENTORDERID", nullable = false, updatable = false)
	private IngredientOrderRequest ingredientOrderRequest;



	public int getAmount() {
		return amount;
	}

	public void setAmount(int amount) {
		this.amount = amount;
	}







	public IngredientOrderRequest getIngredientOrderRequest() {
		return ingredientOrderRequest;
	}

	public void setIngredientOrderRequest(
			IngredientOrderRequest ingredientOrderRequest) {
		this.ingredientOrderRequest = ingredientOrderRequest;
	}

	public String getIngredientId() {
		return ingredientId;
	}

	public void setIngredientId(String ingredientId) {
		this.ingredientId = ingredientId;
	}

	public Ingredient getIngredient() {
		return ingredient;
	}

	public void setIngredient(Ingredient ingredient) {
		this.ingredient = ingredient;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getId() {
		return id;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + amount;
		result = prime * result
				+ ((ingredientId == null) ? 0 : ingredientId.hashCode());
		return result;
	}

	@Override
	public String toString() {
		return "IngredientOrderInfo [id=" + id + ", ingredientId="
				+ ingredientId + ", ingredient=" + ingredient + ", amount="
				+ amount + ", ingredientOrderRequest=" + ingredientOrderRequest
				+ "]";
	}

	



}
